<template>
    <div v-show="isShow">
        <van-tabbar v-model="active">
            <van-tabbar-item icon="home-o">首页</van-tabbar-item>
            <van-tabbar-item icon="comment-o">消息</van-tabbar-item>
            <van-tabbar-item icon="user-o">我的</van-tabbar-item>
        </van-tabbar>
    </div>
</template>

<script>
export default {
    name: "NavBar",
    data() {
        return {
            // 默认选项
            active: 0,
            // 是否展示
            isShow: true
        }
    },
    methods: {

    },
    watch: {
        '$route': function (to, from) {
            if (to.path.match("/authorization") || to.path.match("/service/") || to.path.match("/user/edit") ||
                to.path.match("/user/order") || to.path.match("/user/address") || to.path.match("/user/deal") ||
                to.path.match("/message/chat") || to.path.match("/doctor")) {
                this.isShow = false
            }
            else this.isShow = true
        },
        active: function (newValue, oldValue) {
            if (newValue == 0) this.active = 0, this.$router.push('/index')
            else if (newValue == 1) this.active = 1, this.$router.push('/message')
            else if (newValue == 2) this.active = 2, this.$router.push('/user')
        }
    }
}
</script>

<style></style>